package com.ruoyi.system.utils;

import com.ruoyi.system.DTO.Response.LoginResponseDTO;
import com.ruoyi.system.pojo.user.User;

/**
 * Description:
 *
 * @author JourWon
 * @date Created on 2025/5/13
 */
public class UserConvertUtil {

    /**
     * 将User转换为LoginResponseDTO
     */
    public static LoginResponseDTO convertToLoginResponse(User user, String token) {
        LoginResponseDTO response = new LoginResponseDTO();
        response.setUserId(Long.valueOf(user.getId()));
        response.setUserName(user.getUserName());
        response.setRoleCode(user.getRoleCode());
        response.setToken(token);
        response.setSuccess(true);
        response.setMsg("登录成功");
        response.setRegionId(String.valueOf(user.getRegionId()));
        response.setIsRepair(false);
        return response;
    }
}
